package com.douguo.recipe;

import com.douguo.recipe.view.NavigationView;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.LinearLayout.LayoutParams;

public class AboutActivity extends DouguoActivity {

	private NavigationView mNavigation;
	private Button mBtnBack;
	
	private static final int MENU_HOME = Menu.FIRST;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.about);
		
		initUI();
	}

	private void initUI() {
		mNavigation = new NavigationView(this,NavigationView.STATE_MORE);
		mBtnBack = (Button) findViewById(R.id.imageButton_back);
		mBtnBack.setOnClickListener(new OnClickListener() {

			public void onClick(View v) {
				finish();
			}
		});
		findViewById(R.id.imageButton_back).setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				finish();
				
			}
		});
		setTitle(getString(R.string.titleGuanYuWoMen));
		

		WebView webView = (WebView) findViewById(R.id.web_view);
		webView.loadUrl("file:///android_asset/douguo_intro.html");
		webView.setBackgroundColor(0);
	}
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		menu.add(0, MENU_HOME, 0, R.string.backToHome);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case MENU_HOME:
			Intent homeIntent = new Intent(this, HomeActivity.class);
			homeIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
			startActivity(homeIntent);
			break;
		}
		return true;

	}

}
